<!DOCTYPE html>
<html ng-app="exampleApp">
<head>
    <title>Forms-textarea</title>
    <script src="angular.js"></script>
    <link href="bootstrap.css" rel="stylesheet" />
    <script>
        angular.module("exampleApp", [])
        .controller("defaultCtrl", function ($scope) {
            $scope.message = "";//显示变更数量
            $scope.left = function() {return 100 - $scope.message.length;};
            //清除文本框
            $scope.clear = function() {$scope.message = "";};
            //执行保存操作
            $scope.save = function() {alert("Note Saved");};
        });
    </script>
</head>
<body>
<div id="todoPanel" class="panel" ng-controller="defaultCtrl">
    <form name="myForm" novalidate>
        <div class="well">
            <div class="form-group">
                <textarea ng-model="message" cols="30" rows="10">
                </textarea>
            </div>
        </div>
        <div class="well">
            <p>你还可以输入的字符个数为: {{left()}}</p>
        </div>
        <div class="well">
            <p>你输入的信息: {{message}}</p>
        </div>
    </form>
</div>
</body>
</html>
